document.addEventListener('DOMContentLoaded', () => {
    const textElement = document.getElementById('text');
    const originalText = textElement.textContent;
    textElement.textContent = '';
    const segmenter = new Intl.Segmenter('zh-CN', {
        granularity: 'word'
    });
    const segments = [...segmenter.segment(originalText)];


    segments.forEach((segment, index) => {
        const span = document.createElement('span');
        span.className = 'word';
        span.textContent = segment.segment;
        textElement.appendChild(span);
        span.style.transitionDelay = `${index * 0.1}s`;
    });


    requestAnimationFrame(() => {
        const words = document.querySelectorAll('.word');
        words.forEach(word => {
            word.style.opacity = '1';
            word.style.transform = 'translateY(0)';
        });
    });
});